var a = require("../../../component/WxNotificationCenter/WxNotificationCenter.js"), t = getApp();

Page({
    data: {
        pageNo: 1,
        listDatas: [],
        empty: " "
    },
    orderLoadMore: function(a) {
        this.loadSearchData(!1);
    },
    orderRefresh: function(a) {
        this.loadSearchData(!0);
    },
    clickItem: function(a) {
        var t = a.currentTarget.dataset.index, e = a.currentTarget.dataset.orderid, o = this.data.listDatas;
        o[t].newCount = 0, this.setData({
            listDatas: o
        }), wx.navigateTo({
            url: "/pages/sendOrder/orderDetail/orderDetail?weddingOrderId=" + e
        });
    },
    clickSearch: function(a) {
        wx.navigateTo({
            url: "/pages/add/addOrder/addOrder"
        });
    },
    loadData: function(a) {
        var e = this, o = e.data.pageNo;
        if (a) o = 1; else if (e.data.total == e.data.listDatas.length) return;
        t.network.post({
            url: t.url.ListPlannerWeddingOrder,
            params: {
                pageNo: o,
                pageSize: 20
            },
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(i) {
                if (1 == i.data.result) {
                    var n = [];
                    a || (n = e.data.listDatas), n = n.concat(i.data.data.weddingOrders), console.log(n), 
                    o += 1, e.setData({
                        total: i.data.data.total,
                        listDatas: n,
                        pageNo: o
                    });
                } else t.util.showToast(i.data.message);
            },
            fail: function() {
                t.util.showToast("获取数据失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading(), wx.stopPullDownRefresh();
            }
        });
    },
    updateData: function() {
        this.loadData(!0);
    },
    onLoad: function(t) {
        this.loadData(), a.addNotification("NeedUpdateOrderAskList", this.updateData, this);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {
        a.removeNotification("NeedUpdateOrderAskList", this);
    },
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.loadData(!1);
    },
    onShareAppMessage: function() {
        var a = t.util.getShareInfo();
        return {
            title: t.globalData.commonShareTitle,
            path: a[0],
            imageUrl: a[1],
            success: function(a) {},
            fail: function(a) {}
        };
    }
});